<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="root">index.html</div>
  <dir id="container"></dir>

  <iframe id="iframe" src="./index2.html" frameborder="0"></iframe>
  <script>
    let container = document.getElementById('container')
    console.log('souce::: ', document.getElementById('root'));
    let iframe = document.getElementById('iframe').contentWindow
    console.log('iframe ::: ', iframe.documentElement.body);
    // let root = iframe.contentWindow.document.getElementById('root')
    let root = iframe.document.getElementById('root2')
    console.log('root::: ', root);
  </script>


</body>

</html>